package io_nio;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by butterfly on 2018/6/27.
 */
public class InputStreamReaderDemo {
    public static void main(String[] args) {

        InputStreamReader isr = new InputStreamReader(System.in);//转换成字符输入流
        BufferedReader bufferedReader = new BufferedReader(isr);//因为有读取一行的方法，所以包装成缓冲流
        String buffer = null;
        try {
            while ((buffer = bufferedReader.readLine())!=null){
                if (buffer.equals("exit")){
                    System.exit(1);
                }
                System.out.println("输入内容为====》"+buffer);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                bufferedReader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
